package com.zifan.sever.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.zifan.sever.bean.Admin;
import com.zifan.sever.bean.Role;
import com.zifan.sever.utils.RespBean;
import org.springframework.security.core.Authentication;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author zifan
 * @since 2021-04-10
 */
public interface IAdminService extends IService<Admin> {

    RespBean login(String username, String password , String code , HttpServletRequest request);

    Admin getAdminByUsername(String username);

    List<Role> getRolesByAdminId(Integer id);

    List<Admin> getAllAdmins(String key);

    RespBean updateAdmins(Admin admin);

    RespBean deleteAdmins(Integer id);

    /**
     * 更新操作员的角色
     * @param adminId
     * @param rids
     * @return
     */
    RespBean updateAdminRoles(Integer adminId, Integer[] rids);

    /**
     * 更新用户信息
     * @param admin
     * @param authentication
     * @return
     */
    RespBean updateAdminInfo(Admin admin, Authentication authentication);

    /**
     * 更新用户密码
     * @param oldPass 旧密码
     * @param pass 新密码
     * @param adminId 用户id
     * @return
     */
    RespBean updateAdminPassword(String oldPass,String pass,Integer adminId);

    /**
     * 更新用户头像
     * @param file
     * @param id
     * @param authentication
     * @return
     */
    RespBean updateUsetFace(MultipartFile file, Integer id, Authentication authentication);
}
